<%@page contentType="text/html" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<%@taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link href="<%=application.getContextPath()%>/nresources/ued/css/all-src.css" type="text/css" rel="stylesheet"/>
    <title>逻辑屏列表</title>
    <%@include file="/WEB-INF/ibnms/common/jqgrid.jsp" %>
    <%@include file="/WEB-INF/ibnms/common/formValidation.jsp" %>
    <link href="<%=application.getContextPath()%>/0/libs/pure/pure.css" type="text/css" rel="stylesheet">
    <style type="text/css">
        select {
            width: auto;
        }

        .data-panel-show {
            margin: 5px;
            float: left;
            min-height: 130px;
            border: 1px solid #D3D3D3;
        }

        .data-panel-show:hover img{
            filter:alpha(opacity=50); /*IE滤镜，透明度50%*/
            -moz-opacity:0.5; /*Firefox私有，透明度50%*/
            opacity:0.5;
        }

        .data-panel-show img {
            width: 170px;
            height: 120px;
            cursor: pointer;
        }
        .input-style1 {
            width: 120px;
        }

        .screen-layout ul {
            width: 100%;
            height: 100%;
        }

        .screen-layout li {
            float: left;
            over-flow: hidden;
        }

        .panel {
            background-color: #ffffff;
            border: #D3D3D3 1px solid;
            overflow: hidden;
            margin: 3px;
        }

        .panel-height-half {
            height: 92px;
        }

        .panel-height-whole {
            height: 192px;
        }

    </style>
</head>
<body>
<div class="form-wrapper">
    <div class="form-title">
        <span class="ttcorner"></span>

        <h3>
            <span class="text">逻辑屏管理</span>
        </h3>
    </div>
    <form name="theForm">
        <input type="hidden" name="userForm.DEPT_ID" value="${userForm.DEPT_ID}"/>
    </form>
    <div class="box-in">
        <table border="0" cellspacing="0" cellpadding="0" class="table-03">
            <tr>
                <td class="monitor_bg1" height="13" align="right" nowrap>
                    逻辑屏名：
                    <input type="text" class="input-style1" name="queryForm.logicalScreenName"
                           id="queryFormLogicalScreenName"/>
                    <input type="button" class="btn-style02" id="btn-search" value="查询"/>
                </td>
            </tr>
        </table>
    </div>
    <div class="title-style"><a class="fold-tip"></a></div>
    <div class="block02">
        <div class="title-style02">
            <input class="btn-style02" type="button" id="btn-add" value="增加">&nbsp;&nbsp;
            <input class="btn-style02" type="button" id="btn-edit" value="修改">&nbsp;&nbsp;
            <input class="btn-style02" type="button" id="btn-del" value="删除">&nbsp;&nbsp;
            <input class="btn-style02" type="button" id="btn-rel-logical" value="引用">
        </div>
        <table id="gridTable">
        </table>
        <div id="gridPager">
        </div>
    </div>
</div>
<form id="addLogicalScreenPanel">
    <div class="form-wrapper">
        <div class="box-in">
            <table border="0" cellspacing="0" cellpadding="0" class="table-03">
                <tr>
                    <td class="monitor_bg1" height="13" style="text-align: right" nowrap>
                        逻辑屏名称：
                    </td>
                    <td>
                        <input type="hidden" id="formPhysicalScreenId" name="form.logicalScreenId">
                        <input type="text" id="formPhysicalScreenName" class="input-style1 validate[required]"
                               name="form.logicalScreenName"/>
                    </td>
                </tr>
                <tr>
                    <td class="monitor_bg1" height="13" style="text-align: right" nowrap>
                        显示时间：
                    </td>
                    <td>
                        <input type="text" name="form.showSeconds" id="formShowSeconds"
                               class="input-style1 validate[required,custom[integer]]"/>秒
                    </td>
                </tr>
                <tr>
                    <td class="monitor_bg1" height="13" style="text-align: right" nowrap>
                        切换动画：
                    </td>
                    <td>
                        <select name="form.switchAnimation" id="formSwitchAnimation"
                                style="width:auto;margin-right: 20px;">
                            <optgroup label="滑动" data-group="slide">
                            </optgroup>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="monitor_bg1" height="13" style="text-align: right" nowrap>
                        布局：
                    </td>
                    <td>
                        <input type="hidden" name="form.layout" id="formLayout" class="input-style1"/>
                        <input type="text" id="formLayoutName" readonly class="input-style1 validate[required]"/>
                        <input class="btn-style02" type="button" id="btn-choose-layout" value="选择">
                    </td>
                </tr>
            </table>
        </div>
        <div>数据面板配置：</div>
        <div id="configPanelToLogicalScreenPanel" class="screen-layout"
             style="width:100%;height: 200px;border: 1px solid #D3D3D3;">
            <div class="pure-g" id="layout-field" style="width: 100%;height:100%;display: none;">
                <div class="pure-g" style="width: 100%;height:100px;">
                    <div class="pure-u-1-2">
                        <div class="panel panel-height-half" data-index="1">
                            <input type="button" class="btn-style02 btn-config" value="配置"/>
                        </div>
                    </div>
                    <div class="pure-u-1-2">
                        <div class="panel panel-height-half" data-index="2"><input type="button"
                                                                                   class="btn-style02 btn-config"
                                                                                   value="配置"/></div>
                    </div>
                </div>
                <div class="pure-g" style="width: 100%;height:100px;">
                    <div class="pure-u-1-2 ">
                        <div class="panel panel-height-half" data-index="3"><input type="button"
                                                                                   class="btn-style02 btn-config"
                                                                                   value="配置"/></div>
                    </div>
                    <div class="pure-u-1-2">
                        <div class="panel panel-height-half" data-index="4"><input type="button"
                                                                                   class="btn-style02 btn-config"
                                                                                   value="配置"/></div>
                    </div>
                </div>
            </div>
            <div class="pure-g" id="layout-single" style="width: 100%;height:100%;display: none;">
                <div class="pure-g" style="width: 100%;height:200px;">
                    <div class="pure-u-1-1">
                        <div class="panel panel-height-whole" data-index="1">
                            <input type="button" class="btn-style02 btn-config" value="配置"/>
                        </div>
                    </div>
                </div>
            </div>
            <div class="pure-g" id="layout-left-right" style="width: 100%;height:100%;display: none;">
                <div class="pure-g" style="width: 100%;height:200px;">
                    <div class="pure-u-1-2">
                        <div class="panel panel-height-whole" data-index="1">
                            <input type="button" class="btn-style02 btn-config" value="配置"/>
                        </div>
                    </div>
                    <div class="pure-u-1-2">
                        <div class="panel panel-height-whole" data-index="2">
                            <input type="button" class="btn-style02 btn-config" value="配置"/>
                        </div>
                    </div>
                </div>
            </div>
            <div class="pure-g" id="layout-grid-left" style="width: 100%;height:100%;display: none;">
                <div class="pure-g" style="width: 100%;height:200px;">
                    <div class="pure-u-2-5">
                        <div class="pure-g">
                            <div class="pure-u-1-1">
                                <div class="panel panel-height-half" data-index="1">
                                    <input type="button" class="btn-style02 btn-config" value="配置"/>
                                </div>
                            </div>
                        </div>
                        <div class="pure-g">
                            <div class="pure-u-1-1">
                                <div class="panel panel-height-half" data-index="2">
                                    <input type="button" class="btn-style02 btn-config" value="配置"/>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="pure-u-3-5">
                        <div class="panel panel-height-whole" data-index="3">
                            <input type="button" class="btn-style02 btn-config" value="配置"/>
                        </div>
                    </div>
                </div>
            </div>
            <div class="pure-g" id="layout-grid-right" style="width: 100%;height:100%;display: none;">
                <div class="pure-g" style="width: 100%;height:200px;">
                    <div class="pure-u-3-5">
                        <div class="panel panel-height-whole" data-index="1">
                            <input type="button" class="btn-style02 btn-config" value="配置"/>
                        </div>
                    </div>
                    <div class="pure-u-2-5">
                        <div class="pure-g">
                            <div class="pure-u-1-1">
                                <div class="panel panel-height-half" data-index="2">
                                    <input type="button" class="btn-style02 btn-config" value="配置"/>
                                </div>
                            </div>
                        </div>
                        <div class="pure-g">
                            <div class="pure-u-1-1">
                                <div class="panel panel-height-half" data-index="3">
                                    <input type="button" class="btn-style02 btn-config" value="配置"/>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="block03">
            <input type="button" id="btn-save" class="btn-style02" value="保存"/>&nbsp;&nbsp;
            <input type="button" id="btn-cancel" class="btn-style02" value="取消"/>
        </div>
    </div>
</form>
<div id="chooseLayoutPanel">
    <table class="table-03">
        <td colspan="6">
            设置布局
        </td>
        <tr>
            <td>
                <a rel="layoutSet"><img style="padding-right: 8px;" data-name="单个面板" data-value="layout-single" val="1"
                                        id="edit_this_tab_layoutimg_1"
                                        swap="/portal/nresources/basd/layout/single_highlight.png"
                                        src="/portal/nresources/basd/layout/single.png">
                </a>
            </td>
            <td>
                <a rel="layoutSet"><img style="padding-right: 8px;" data-name="两侧面板" data-value="layout-left-right"
                                        val="2"
                                        id="edit_this_tab_layoutimg_2"
                                        swap="/portal/nresources/basd/layout/left-right_highlight.png"
                                        src="/portal/nresources/basd/layout/left-right.png">
                </a>
            </td>
            <td>
                <a rel="layoutSet"><img style="padding-right: 8px;" data-name="田字布局" data-value="layout-field" val="3"
                                        id="edit_this_tab_layoutimg_3"
                                        swap="/portal/nresources/basd/layout/field_highlight.png"
                                        src="/portal/nresources/basd/layout/field.png">
                </a>
            </td>
            <td>
                <a rel="layoutSet"><img style="padding-right: 8px;" data-name="三个面板-右" data-value="layout-grid-right"
                                        val="4"
                                        id="edit_this_tab_layoutimg_4"
                                        swap="/portal/nresources/basd/layout/grid-right_highlight.png"
                                        src="/portal/nresources/basd/layout/grid-right.png">
                </a>
            </td>
            <td>
                <a rel="layoutset"><img style="padding-right: 8px;" data-name="三个面板-左" data-value="layout-grid-left"
                                        val="5"
                                        id="edit_this_tab_layoutimg_5"
                                        swap="/portal/nresources/basd/layout/grid-left_highlight.png"
                                        src="/portal/nresources/basd/layout/grid-left.png">
                </a>
            </td>
        </tr>
    </table>
    <div class="block03">
        <input type="button" id="btn-save-layout" class="btn-style02" value="确定"/>
    </div>
</div>
<div id="dataPanelDialog">
</div>
<div id="data-panel-templet" class="data-panel-show" style="display: none;"><img
        src=""/></div>
</body>
<script type="text/javascript" src="<%=application.getContextPath()%>/njs/basd/common/commons.min.js"></script>
<script type="text/javascript">
    var globalParam = {
        currentPhysicalId: "null",
        currentConfigPanel: null,
        panels: {},
        imgTemplet: $("<img>").css({width: "100%", height: "100%"}),
        urlPrefix: "/portal/ibnms/img/",
        layout: {
            "layout-single": "单个面板", "layout-left-right": "两侧面板",
            "layout-field": "田字布局", "layout-grid-left": "三个面板-左", "layout-grid-right": "三个面板-右"
        },
        animate: {}
    };
    $(function () {
        $(".title-style a.fold-tip").toggle(toggletip, toggletip);
        function toggletip() {
            if ($(this).attr("class").split("unfold-tip").length > 1) {
                $(this).removeClass("unfold-tip");
                $(this).parents().prev(".box-in").show("fast");
            } else {
                $(this).addClass("unfold-tip");
                $(this).parents().prev(".box-in").hide("fast");
            }
        }
    });

    $(function () {
        $.getJSON("<%=application.getContextPath()%>/ibnms/cfg/logical-screen-animate.json", function (data) {
            var optionTemplate = $("<option>");
            var $select = $("#formSwitchAnimation").children();
            var animate = {};
            for (var i = 0; i < data.length; i++) {
                animate[data[i].value] = data[i].name;
                for (var j = 0; j < data.length; j++) {
                    if (data[i].group == $select.eq(j).attr("data-group")) {
                        optionTemplate.clone().attr("value", data[i].value).html(data[i].name).appendTo($select.eq(j));
                        break;
                    }
                }
            }
            globalParam.animate = animate;
        });
        $("#gridTable").jqGrid({
            url: "<s:url action="logicalScreenJson" namespace="/ibnms/bigscreen"/>",
            datatype: "json",
            mtype: "POST",
            height: "100%",
            autowidth: true,
            colNames: ['逻辑屏ID', '逻辑屏名称', '切换动画id', '切换动画', '显示时间', '布局', '布局id', '显示时间id'],
            colModel: [
                {name: 'logicalScreenId', index: 'LOGICAL_SCREEN_ID', hidden: true},
                {name: 'logicalScreenName', index: 'LOGICAL_SCREEN_NAME'},
                {name: 'switchAnimation', index: 'SWITCH_ANIMATION', hidden: true},
                {
                    name: 'switchAnimationName', index: 'SWITCH_ANIMATION', formatter: function (val, op, row) {
                    return globalParam.animate[row.switchAnimation];
                }
                },
                {
                    name: 'showSecondsName', index: 'SHOW_SECONDS', formatter: function (val, op, row) {
                    return row.showSeconds + "秒";
                }
                },
                {
                    name: 'layoutName', index: 'LAYOUT', formatter: function (val, op, row) {
                    return globalParam.layout[row.layout];
                }
                },
                {name: 'showSeconds', hidden: true, index: 'SHOW_SECONDS'},
                {name: 'layout', hidden: true, index: 'LAYOUT'}
            ],
            viewrecords: true,
            rowNum: 15,
            rowList: [10, 15, 30],
            jsonReader: {
                root: 'rows',
                page: 'page',
                total: 'total',
                records: 'records',
                repeatitems: false,
                subgrid: {
                    root: 'rows',
                    page: 'page',
                    total: 'total',
                    records: 'records',
                    repeatitems: false
                }
            },
            pager: "#gridPager",
            hidegrid: true,
            multiselect: true,
            beforeRequest: function () {
                var postData = {
                    "form.logicalScreenName": $("#queryFormLogicalScreenName").val()
                };
                $.extend($("#gridTable").getGridParam("postData"), postData);
            }
        });
        //加载数据面板数据
        $.getJSON("<%=application.getContextPath()%>/ibnms/cfg/data-panel.json", function (data) {
            var $dataPanelTemplet = $("#data-panel-templet").removeAttr("id");
            var $showDataPanel = $("#dataPanelDialog");
            for (var i = 0; i < data.length; i++) {
                globalParam.panels[data[i].id] = data[i].img;
                var $panel = $dataPanelTemplet.clone(true, true).show().attr("data-panel-id", data[i].id);
                $panel.find("img").attr("src", globalParam.urlPrefix + data[i].img);
                $showDataPanel.append($panel);
            }
        });
    });

    $(function () {
        $("a[rel='layoutSet']").click(function () {
            var $imgObj = $(this).find("img");
            var imgsrc = $imgObj.attr("src");
            var imgswap = $imgObj.attr("swap");
            $("a[rel='layoutSet'] > img").each(function () {
                var $imgEle = $(this);
                var imgEleSrc = $imgEle.attr("src");
                var imgEleSwap = $imgEle.attr("swap");
                if (imgEleSrc.toString().indexOf("_highlight") > 0) {
                    $imgEle.attr("src", imgEleSwap);
                    $imgEle.attr("swap", imgEleSrc);
                }
            });
            $imgObj.attr("src", imgswap);
            $imgObj.attr("swap", imgsrc);
        });
        $("input.btn-config").click(function () {
            $("#dataPanelDialog").dialog("open");
            globalParam.currentConfigPanel = $(this).parent();

        });
        $("#data-panel-templet img").click(function () {
            var $btn = $(this);
            globalParam.currentConfigPanel.find("img").remove();
            var imgHeight = globalParam.currentConfigPanel[0].className.indexOf("half") != -1 ? "72px" : "172px"
            globalParam.currentConfigPanel.append($btn.clone().css({width: "100%", height: imgHeight}));
            globalParam.currentConfigPanel.attr("data-panel-id", $btn.parent().attr("data-panel-id"));
            $("#dataPanelDialog").dialog("close");
        });
        $("#addLogicalScreenPanel").show().dialog({
            title: "增加逻辑屏",
            width: 360,
            modal: true,
            resizable: false,
            autoOpen: false
        });
        $("#chooseLayoutPanel").show().dialog({
            title: "选择布局",
            width: 500,
            modal: true,
            resizable: false,
            autoOpen: false
        });
        $("#dataPanelDialog").show().dialog({
            title: "选择数据面板",
            width: 760,
            modal: true,
            resizable: false,
            autoOpen: false,
            close: function () {
                globalParam.currentConfigPanel = null;
            }
        });
        $("#btn-choose-layout").click(function () {
            $("#chooseLayoutPanel").dialog("open");
        });
        $("#btn-save-layout").click(function () {
            var currentLayout = $("#formLayout").val();
            if (currentLayout != "") {
                if ($("#" + currentLayout).find("img").size() > 0) {
                    if (!window.confirm("当前布局配置了数据面板，是否确认重新选择布局(当前布局的数据面板将重置)")) {
                        return;
                    }
                }
            }
            $("#chooseLayoutPanel").dialog("close");
            $("a[rel='layoutSet'] > img").each(function () {
                var $imgEle = $(this);
                var imgEleSrc = $imgEle.attr("src");
                if (imgEleSrc.toString().indexOf("_highlight") > 0) {
                    var layout = $imgEle.attr("data-value");
                    $("#formLayout").val(layout);
                    $("#formLayoutName").val(globalParam.layout[layout]);
                    var $showLayout = $("#" + layout);
                    $showLayout.show().siblings().hide();
                    $showLayout.find("img").remove();
                    $showLayout.find("[data-panel-id]").removeAttr("data-panel-id");
                }
            });
        });
        $("#btn-save").click(function () {
            if (!$("#addLogicalScreenPanel").validationEngine("validate")) {
                return false;
            }
            validateExistName($("#formPhysicalScreenId").val(), $("#formPhysicalScreenName").val(), function () {
                var param = $("#addLogicalScreenPanel").serializeArray();
                var panels = $("#" + $("#formLayout").val()).find("div[data-panel-id]");
                for (var i = 0; i < panels.size(); i++) {
                    var $panel = $(panels[i]);
                    param.push({
                        "name": "panels[" + i + "].panelId",
                        "value": $panel.attr("data-panel-id")
                    });
                    param.push({
                        "name": "panels[" + i + "].seq",
                        "value": $panel.attr("data-index")
                    })
                }
                $.ajax({
                    url: "<s:url action="addLogicalScreen" namespace="/ibnms/bigscreen"/>",
                    type: "POST",
                    cache: false,
                    async: true,
                    data: param,
                    success: function () {
                        $("#addLogicalScreenPanel").dialog("close");
                        $("#gridTable").trigger("reloadGrid", [{page: 1}]);
                    },
                    error: function () {

                    }
                });
            });
        });

        $("#btn-cancel").click(function () {
            $("#addLogicalScreenPanel").dialog("close");
        });

        $("#btn-search").click(function () {
            $("#gridTable").trigger("reloadGrid", [{page: 1}]);
        });
        $("#showLayoutAndAnimation").click(function () {
            $(this).hide(2000);
        });

        $("#btn-add").click(function () {
            $("#addLogicalScreenPanel").resetForm().dialog("open").find("input[type=hidden]").val("");
            $("#formPhysicalScreenId").val("");
            $("#configPanelToLogicalScreenPanel").children().hide();
        });
        $("#btn-del").click(function () {
            var idArr = jQuery("#gridTable").jqGrid('getGridParam', 'selarrrow');
            if (idArr.length == 0) {
                alert("请先选择要删除的记录!");
                return;
            }
            if (confirm("是否删除所选的记录?")) {
                var LOGIN_ID = "";
                for (var one in idArr) {
                    var dataLogical = jQuery("#gridTable").jqGrid('getRowData', idArr[one]);
                    $.ajax({
                        type: "get",
                        async: false,
                        url: "<s:url action="queryPhysicalScreenByLogicalId" namespace="/ibnms/bigscreen"/>?form.logicalScreenId=" + dataLogical.logicalScreenId,
                        success: function (data) {
                            if(data){
                                if(data.length==0){
                                    LOGIN_ID += dataLogical.logicalScreenId + "!!";
                                }else{
                                    alert("逻辑屏 "+dataLogical.logicalScreenName+" 正在被 "+data.join(",")+" 引用，无法删除");
                                }
                            }
                        },
                        error: function (xhr) {
                        }
                    });
                }
                if (LOGIN_ID.length > 0) {
                    LOGIN_ID = LOGIN_ID.substring(0, LOGIN_ID.length - 2);
                }
                $.ajax({
                    type: "POST",
                    async: false,
                    url: "<s:url action="deleteLogicalScreen" namespace="/ibnms/bigscreen"/>?form.logicalScreenId=" + LOGIN_ID,
                    success: function (data) {
                        $("#gridTable").trigger('reloadGrid');
                    },
                    error: function (xhr) {
                    }
                });
            }
        });
        $("#btn-edit").click(function () {
            var idArr = jQuery("#gridTable").jqGrid('getGridParam', 'selarrrow');
            switch (idArr.length) {
                case 0:
                    alert("请先选择要修改的记录!");
                    break;
                case 1:
                    var data = jQuery("#gridTable").jqGrid('getRowData', idArr[0]);
                    var logicalScreenId = data.logicalScreenId;
                    $.get("<s:url action="queryLogicalScreenById" namespace="/ibnms/bigscreen"/>?form.logicalScreenId=" + logicalScreenId, {}, function (data) {
                        if (data) {
                            var form = data.form;
                            var formData = {};
                            formData["form.logicalScreenId"] = form.logicalScreenId;
                            formData["form.logicalScreenName"] = form.logicalScreenName;
                            formData["form.switchAnimation"] = form.switchAnimation
                            formData["form.showSeconds"] = form.showSeconds;
                            formData["form.layout"] = form.layout;
                            $("#formLayoutName").val(globalParam.layout[form.layout]);
                            var $layout = $("#" + form.layout);
                            $layout.find("img").remove();
                            $layout.show().siblings().hide();
                            var panels = data.panels;
                            var panelDiv = $layout.find("[data-index]");
                            for (var j = 0; j < panelDiv.length; j++) {
                                var $panel = $(panelDiv[j]);
                                $panel.removeAttr("data-panel-id");
                                var index = $panel.attr("data-index");
                                for (var i = 0; i < panels.length; i++) {
                                    if (index == panels[i].seq) {
                                        var panelId = panels[i].panelId;
                                        $panel.attr("data-panel-id", panelId);
                                        $panel.append(globalParam.imgTemplet.clone().attr("src", globalParam.urlPrefix + globalParam.panels[panelId]));
                                        break;
                                    }
                                }
                            }
                            $("#addLogicalScreenPanel").fillForm(formData).dialog("open");
                        }
                    });
                    break;
                default:
                    alert("一次只能修改一条记录!");
            }
        });

        $("#btn-rel-logical").click(function () {
            var idArr = jQuery("#gridTable").jqGrid('getGridParam', 'selarrrow');
            switch (idArr.length) {
                case 0:
                    alert("请先选择要引用的记录!");
                    break;
                default:
                    $("#gridTable").trigger("reloadGrid", [{page: 1}]);
                    var dataArray = [];
                    for (var i = 0; i < idArr.length; i++) {
                        var data = jQuery("#gridTable").jqGrid('getRowData', idArr[i]);
                        dataArray.push(data);
                    }
                    var existIds = window.parent.getExistLogicalScreenIds();
                    var repeatIds = [];
                    var indexArray = [];
                    for (var j = 0; j < dataArray.length; j++) {
                        for (var i = 0; i < existIds.length; i++) {
                            if (dataArray[j].logicalScreenId == existIds[i]) {
                                repeatIds.push(dataArray[j].logicalScreenName);
                                indexArray.push(j);
                                break;
                            }
                        }
                    }
                    if (repeatIds.length > 0) {
                        if (window.confirm(repeatIds.join(",") + " 在该物理屏中已经存在，确定重复添加吗?")) {
                            window.parent.relatedLogicalScreen(dataArray, existIds.length);
                        } else {
                            for (var i = 0; i < indexArray.length; i++) {
                                dataArray.splice(indexArray[i] - i, 1);
                            }
                            window.parent.relatedLogicalScreen(dataArray, existIds.length);
                        }
                    } else {
                        window.parent.relatedLogicalScreen(dataArray, existIds.length);
                    }
            }
        });
    });
    function reloadGrid() {
        $("#gridTable").trigger("reloadGrid", [{page: 1}]);
    }
    function validateExistName(id, name, callback) {
        $.get("<s:url action="ifLogicalNameExist" namespace="/ibnms/bigscreen"/>", {
            "form.logicalScreenId": id,
            "form.logicalScreenName": name
        }, function (data) {
            if (data === true) {
                alert("已经存在相同名字的逻辑屏！");
            } else {
                callback();
            }
        });
    }
</script>
<script type="text/javascript">
</script>
</html>
